package com.xuln.common.base.service;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xuln.common.base.dao.BaseDao;

/**
 * @author 徐炉南 xinlunan487@163.com
 * @param <T>
 */
@Service
@Transactional
public class BaseService<T> {
	protected final Log log = LogFactory.getLog(getClass());

	/**
	 * 数据库访问接口
	 */
	private BaseDao baseDao;

	public BaseDao getBaseDao() {
		return baseDao;
	}

	public void setBaseDao(BaseDao baseDao) {
		this.baseDao = baseDao;
	}

	public Object getEntity(Serializable id) {
		return baseDao.find(id);
	}

	public List<T> loadAll() {
		return <T> baseDao.loadAll();
	}
}
